package com.dms.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import com.dms.dao.*;
import com.dms.model.StuLog;
@Service
public class StuLogService {
	@Resource
	private StuLogDao dao;
	
	public StuLog getStuLog(int id){
		String hql="from StuLog where id="+id;
		return dao.getStuLog(hql);
	}
	
	public void updateStuLog(StuLog stuLog) {
		dao.updateStuLog(stuLog);
	}
	
	public List<StuLog> getStuLogList(){
		String hql="from StuLog";
		return dao.getStuLogs(hql);
	}
	
	public List<StuLog> getLogsByStudent(String sId){
		String hql="from StuLog where student.id="+sId;
		return dao.getStuLogs(hql);
	}
	
	public List<StuLog> getLogsByTeacher(String tId){
		String hql="from StuLog where teacher.id="+tId;
		return dao.getStuLogs(hql);
	}
	
	public void saveStuLog(StuLog stuLog){
		dao.save(stuLog);
	}
	
	public void deleteStuLog(int id){
		dao.delete(id);
	}
	
}
